<?php
/**
 * Created by PhpStorm.
 * User: wodrow
 * Date: 18-11-23
 * Time: 下午6:04
 */
/**
 * @var \yii\web\View $this
 */
use kartik\tree\TreeView;
use admin\modules\rbac\models\Menu;

$this->title = "菜单管理";
?>

<?php
echo TreeView::widget([
    // single query fetch to render the tree
    'query'             => Menu::find()->addOrderBy('root, lft'),
    'headingOptions'    => ['label' => 'test-tree'],
    'rootOptions' => ['label'=>'<span class="text-primary">根</span>'],
    'topRootAsHeading' => true, // this will override the headingOptions
//        'fontAwesome' => true,
//        'displayValue'      => 1,                           // initial display value
//        'fontAwesome' => false,     // optional
    'isAdmin' => Yii::$app->user->identity->is_super?true:false,         // optional (toggle to enable admin mode)
    'softDelete' => true,       // defaults to true
    'cacheSettings' => [
        'enableCache' => true   // defaults to true
    ],
    'nodeView' => '@admin/modules/rbac/views/menu/_form_tree',
    'nodeAddlViews' => [
        \kartik\tree\Module::VIEW_PART_2 => '@admin/modules/rbac/views/menu/_tree_2',
    ],
]);

/*echo TreeViewInput::widget([
    // single query fetch to render the tree
    'query'             => TestTree::find()->addOrderBy('root, lft'),
    'headingOptions'    => ['label' => 'tt'],
    'name'              => 'tt',    // input name
    'value'             => '1,2,3',         // values selected (comma separated for multiple select)
    'asDropdown'        => true,            // will render the tree input widget as a dropdown.
    'multiple'          => true,            // set to false if you do not need multiple selection
    'fontAwesome'       => true,            // render font awesome icons
    'rootOptions'       => [
        'label' => '<i class="fa fa-tree"></i>',
        'class'=>'text-success'
    ],                                      // custom root label
    //'options'         => ['disabled' => true],
]);*/
?>
